package com.arron.DesignMode.factory.simplefactory;

/**
 * @Classname OperationFactory
 * @Date 2020/11/20 11:00
 * @Created by 刘
 */
public class OperationFactory {



    public static Operation createOperation(String type){

        Operation operation = null;

        switch (type){
            case "+":
                operation = new AddOperation();
                operation.setNumberA(0);
                operation.setNumberB(0);
                break;
            case "*":
                operation = new MultiOperation();
                operation.setNumberB(0);
                operation.setNumberA(0);
                break;
        }

        return operation;
    }

}
